
let url = location.href
let valEle = splitStrToObject(url)
let valEle_1 = decodeURI(valEle.word)

//数据ajax
function ajax_s() {
    $.ajax({
        type: 'get',
        url: `http://www.xiongmaoyouxuan.com/api/search`,
        data: {
            word:valEle_1,
        },
        success: function (data) { //响应的参数
            list(data.data.list)
            console.log(data);
        }
    })
}
ajax_s()
//商品列表
function list(itme) { 
    let str = ``
    let str1 = itme.map(function (is) {
            return `<div id='${is.id}'>
            <img src="${is.image}" alt="">
                <p>${is.title}</p>
                <p><span>淘宝</span><span>${is.isFreePostage ? '包邮' : '不包邮'}</span></p>
                <p>
                    <span>￥</span>
                    <span>${is.originPrice}</span>
                    <span>${is.saleNum}人已买</span>
                    <span>${is.couponValue}</span>
                </p>
        </div>`
    })
    str += str1.join('')
    $('#list').html(str)
    details()
}

$('.btn_s').click(function () {
    valEle_1 = $('.btn_l').val()
    ajax_s()
    $('.btn_l').val('')
})

